// pages/micholl/micholl.js
let {getSinggerList} = require("../../utils/request.js")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navList:"热abcdefghijklmnopqrstuvwxyz".split(''),
    tag:"-1",
    singgerList:[]

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // 请求数据
    this.getList()
  },
  async getList(){
    let res = await getSinggerList(this.data.tag);
    // console.log(res);
    this.setData({
      singgerList:res.data.artists
    })
  },
  searchTag(e){
    let tag = e.currentTarget.dataset.tag;
    if(tag == "热"){
      tag=-1
    }
    this.setData({
      singgerList:[],
      tag:tag
    },()=>{
      
      this.getList()
    })
  },
  goInfo(e){
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/topInfo/topInfo?singgerid=${id}`,
    })
  }

})